<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="">所有文章</a></li>
        <li><a href="{:url('AdminArticle/add')}">添加文章</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="get" action="{:url('AdminArticle/articleSetting')}">
        标题关键字:
        <input type="text" class="form-control" name="search" style="width: 200px;"
               placeholder="请输入标题关键字...">
        <input type="submit" class="btn btn-primary" value="搜索"/>
    </form>
    <form class="js-ajax-form" action="" method="post">
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="50">ID</th>
                <th>标题</th>
                <th>分类</th>
                <th width="65">点击量</th>
                <th width="65">评论量</th>
                <th width="160">文章简介</th>
                <th width="130">发布时间</th>
                <th width="130">更新时间</th>
                <th width="90">操作</th>
            </tr>
            </thead>
            <eq name="hasInfo" value="1">
            <volist name="articles" id="vo">
                <tr>
                    <td><b>{$vo.id}</b></td>
                    <td>
                        <a href="{:url('Article/detail')}?article_id={$vo.id}" target="_blank">{$vo.title}</a>
                    </td>
                    <td>
                        <span>{$vo.category_name}</span>
                    </td>
                    <td>{$vo.read_times}</td>
                    <td>{$vo.comment_nums}</td>
                    <td>
                        {$vo.introduce}
                    </td>
                    <td>
                        {$vo.create_time}
                    </td>
                    <td>
                        {$vo.update_time}
                    </td>
                    <td>
                        <a data-toggle="tooltip" title="编辑" href="{:url('AdminArticle/edit')}?id={$vo.id}"><i class="fa fa-edit fa-2x"></i></a>
                        <a data-toggle="tooltip" title="删除" class="js-ajax-delete" href="{:url('AdminArticle/del')}?id={$vo.id}" data-msg="将删除文章以及所属评论!"><i class="fa fa-trash-o fa-2x"></i></a>
                    </td>
                </tr>
            </volist>
            </eq>
        </table>
        <div class="pagination">{$articles->render()|default=''}</div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    function articleDel($id) {
        $.ajax({
            url:"{:url('AdminArticle/del')}?id="+$id,
            success:function (res) {
                if(res.valid){
                    alert(res.msg);
                    window.location.reload();
                }else{
                    alert(res.msg);
                }
            }
        });
    }
</script>
</body>
</html>